package com.wm.youfangtong.logic.network

import com.wm.module_common.config.Param
import com.wm.module_common.http.ApiService
import com.wm.youfangtong.BuildConfig
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object HttpUtil {

    private lateinit var apiService: ApiService

    // 初始化 retrofit
    fun initRetrofit() {
        val retrofit: Retrofit = Retrofit.Builder()
            .baseUrl(if (BuildConfig.DEBUG) Param.debugUrl else Param.releaseUrl)
            .addConverterFactory(GsonConverterFactory.create())
            .build()

        apiService = retrofit.create(ApiService::class.java)
    }

    fun getService(): ApiService {
        return apiService
    }

}